<%
    /**
     *
     *
     *
     *
     */
%>
<script>
    function initOrderBy(orderBy,sortType)
    {
        try
        {
            for(var i = 0; i < document.images.length; i ++)
            {
                // 初始化上箭头
                if(document.images[i].imgType == "orderByUp")
                {
                    if(document.images[i].orderBy == orderBy 
                    && "<%= request.getParameter("sortType")%>" == "<%= Title4Sort.UP%>")
                    {
                        document.images[i].src = "<%= request.getContextPath()%>/images/list/upup2.gif";
                    }
                    else
                    {
                        document.images[i].src = "<%= request.getContextPath()%>/images/list/upup.gif";
                        document.images[i].style.display = "none";
                    }
                    continue;
                }
                // 初始化下箭头
                if(document.images[i].imgType == "orderByDown")
                {
                    if(document.images[i].orderBy == orderBy 
                    && "<%= request.getParameter("sortType")%>" == "<%= Title4Sort.DOWN%>")
                    {
                        document.images[i].src = "<%= request.getContextPath()%>/images/list/downdown2.gif";
                    }
                    else
                    {
                        document.images[i].src = "<%= request.getContextPath()%>/images/list/downdown.gif";
                        document.images[i].style.display = "none";
                    }
                    continue;
                }
                
            }
            
        }
        catch(err)
        {
    //        alert(err);
        }
    }
    
    function sort(orderBy)
    {
        if(orderBy == orderBy)
        {
            if(sortForm.sortType.value == "<%= Title4Sort.UP%>")
            {
                sortDownBy(orderBy);
            }
            else
            {
                sortUpBy(orderBy);
            }
        }
        else
        {
            sortDownBy(orderBy);
        }
    }
    function sortUpBy(orderBy)
    {
        sortForm.orderBy.value = orderBy;
        sortForm.sortType.value = "<%= Title4Sort.UP%>";
        sortForm.submit();
    }

    function sortDownBy(orderBy)
    {
        sortForm.orderBy.value = orderBy;
        sortForm.sortType.value = "<%= Title4Sort.DOWN%>";
        sortForm.submit();
    }
</script>
<script>
    // init orderBy
    initOrderBy("<%= request.getParameter("orderBy")%>","<%= request.getParameter("sortType")%>");
</script>
<%
    logger.info("初始化orderBy标题");
    Object[] keys1 = request.getParameterMap().keySet().toArray();
    
%>
<form name="sortForm" method="get" action="<%= ControllerURL%>">
<%
    for(int i = 0; i < keys1.length; i ++)
    {
        Object key = keys1[i];
        String[] values = (String[])request.getParameterMap().get(key);
        for(int j = 0; j < values.length; j ++)
        {
%>
    <input type="hidden" name="<%= key%>" value="<%= values[j]%>">
<%
        } // for ( j
    }// for ( i
%>
<%
    if(request.getParameterMap().get("orderBy") == null)
    {
%>
    <input type="hidden" name="orderBy" >
    <input type="hidden" name="sortType" >
<%
    }// if
%>
</form>
